import pytest
import requests

from api.ihrmemploee import IhrmEmploeeApi
from common.DBUtil import DBUtil
from common.assert_util import common_assert
from common.get_json_util import read_json_data
from config import IHRM_EMP_INSERT_JSON_DATA_PATH

class TestIhrmEmploeeInsert:
    def setup(self):
        #链接数据库删除手机号
        DBUtil.uid_db("delete from bs_user where mobile='15626729939';")
    def teardown(self):
        #清理脏数据
        DBUtil.uid_db("delete from bs_user where mobile='15626729939';")

    @pytest.mark.parametrize("json_data,status_code,success,code,message",read_json_data(IHRM_EMP_INSERT_JSON_DATA_PATH))
    def test_ihrm_emploee_insert(self,json_data,status_code,success,code,message):
        # 发送员工添加接口请求
        em_insert_resp=IhrmEmploeeApi.ihrm_emploee_insert_api(json_data)

        common_assert(em_insert_resp,status_code,success,code,message)
